package com.woniu.controller;

import com.woniu.entity.Equipment;
import com.woniu.entity.Ward;
import com.woniu.service.EquipmentService;
import com.woniu.utils.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/equip")
public class EquipmentController {
    @Resource
    private EquipmentService equipmentService;

    @GetMapping("/findAll")
    public ResponseUtil selectAll(@RequestParam Integer pageNum, @RequestParam Integer pageSize){
        return equipmentService.findAll(pageNum,pageSize);
    }
    @GetMapping("/find")
    public ResponseUtil selectByCondition(@RequestParam(required = false) String equipName,@RequestParam(required = false) String roomName,@RequestParam(required = false) Integer status,@RequestParam Integer pageNum,@RequestParam Integer pageSize){
        return equipmentService.selectByCondition(equipName,roomName,status,pageNum,pageSize);
    }
    @PostMapping("/del")
    public ResponseUtil updateEquipment(Integer id){
        return equipmentService.updateEquipment(id);
    }
    @PostMapping("/insert")
    public ResponseUtil insertSelective(@RequestBody Equipment record){
        return equipmentService.insertSelective(record);
    }
    @PostMapping("/update")
    public ResponseUtil updateByPrimaryKeySelective(@RequestBody Equipment record){
        return equipmentService.updateByPrimaryKeySelective(record);
    }
    @PostMapping("/confirm")
    public  ResponseUtil confirmMaintenance(@RequestParam Integer id){
        return equipmentService.confirmMaintenance(id);
    }
}
